﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace AppfabricAdministrator.Entities
{
    public class Message:INotifyPropertyChanged
    {
        private String _messageText;
        public event PropertyChangedEventHandler PropertyChanged;

        public String MessgageText
        {
            get { return _messageText; }
            set
            {
                _messageText = value;
                OnPropertyChanged("Message");
            }
        }
        public MessageType MessageType { get; set; }

        protected void OnPropertyChanged(string name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }

        public void SetMessage(String _message, MessageType _messageType=MessageType.Information)
        {
            this.MessageType = _messageType;
            this.MessgageText = _message;
        }
    }

    public enum MessageType
    {
        Error,
        Information
    }
}
